
Vue.createApp({
    // 定义组件
    components:{
        'my-article': ARTICLE,
        "dynamic-user-info": DYNAMIC_USER_INFO,
    },
    // 初始化
    setup(){
        // reactive定义变量运行存储
        // toRefs将数据返回
        const {
            reactive, toRefs
        } = Vue
        // 定义变量，即所需数据
        const state = reactive({
            user:{},
            comments: [],
            option: "评论了文章"
        })
        
        let that = state
        let href = location.href.split("/")
        let userId = href[href.length - 1]
        get("/getUserById/" + userId, function(data){
            that.user = data
        })
        $.get("/getCommentArticle/" + userId, function(data){
            that.comments = data
        });
        // 返回数据
        return {
            ...toRefs(state)
        }
    }
    // 绑定app
}).mount("#commentArticle")